package com.wennimei.dao;

import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

import com.wennimei.domain.SinaNews;

@DAO
public interface NewsDAO {

    @SQL("insert ignore into sina_news (title,link,description,pubDate,type) "
            + "values (:1.title,:1.link,:1.description,:1.pubDate,:2)")
    public void insert(SinaNews news, String type);

    @SQL("select * from sina_news where type = :1 and pubDate > :1 order by rand() limit 2")
    public List<SinaNews> getByType(String type, String date);

    @SQL("select * from sina_news where pubDate > :1  order by rand() limit 2")
    public List<SinaNews> get(String date);

    @SQL("select * from sina_news where type = :1 order by pubDate desc limit 2")
    public List<SinaNews> getByType(String type);

}
